<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Vue中的JS动画与velocity.js</title>
	<script type="text/javascript" src="../js/vue.js"></script>
</head>
<body>
	<div id="app">
		<transition 
		  	name="fade"
			@before-enter="handleBeforeEnter"
			@enter="handleEnter"
			@after-enter="handleAfterEnter"		  	
		>
		<div v-show="show">Hello Vue.js</div>
		</transition>
		<button @click="change">转换</button>
	</div>
	<script type="text/javascript">
		var vm = new Vue({
			el: '#app',
			data: {
				show: true
			},
			methods: {
				change: function() {
					this.show = !this.show
				},
				handleBeforeEnter: function(el) {
					console.log('before-enter')
					el.style.color='red'
				},
				handleEnter: function(el, done) {
					setTimeout(() => {
						el.style.color = 'green'
					}, 2000)

					setTimeout(() => {
						done()
					}, 4000)
				},
				handleAfterEnter: function(el) {
					el.style.color = "#000"
				}
			}
		})
	</script>
</body>
</html>